//=============================================================================
// SentinelRocketLauncher - Works like the PepperPot.
//=============================================================================
class SentinelRocketLauncher extends SentinelWeapon;

function float MaxRange()
{
	return ProjectileClass.Default.Speed * ProjectileClass.Default.LifeSpan;
}

function Projectile FireAt(vector Start, vector BarrelDir, vector Aim)
{
	local Projectile Proj;
	local Vector RealStartProj, Y, Z;
	local int p;

	if(AmmoAmount < 1)
		return None;

	AmmoAmount -= AmmoPerFire;

    SetTeam();
	PlaySound(FireSound);
	Sentinel.MakeNoise(Loudness);

	Y = vect(0, 1, 0) >> rotator(Aim);
	Z = vect(0, 0, 1) >> rotator(Aim);

	Start += Z * 5;

	for (p = 0; p < 9; p++)
	{
		if(p == 1)
			RealStartProj = Start + Y * 8;
		else if(p == 2)
			RealStartProj = Start - Y * 8;
		else if(p == 3)
			RealStartProj = Start + Z * 8;
		else if(p == 4)
			RealStartProj = Start - Z * 8;
		else if(p == 5)
		{
			RealStartProj = Start + Y * 16;
			RealStartProj += Z * 12;
		}
		else if(p == 6)
		{
			RealStartProj = Start - Y * 16;
			RealStartProj += Z * 12;
		}
		else if(p == 7)
		{
			RealStartProj = Start + Y * 16;
			RealStartProj -= Z * 12;
		}
		else if(p == 8)
		{
			RealStartProj = Start - Y * 16;
			RealStartProj -= Z * 12;
		}
		else
			RealStartProj = Start;

		Proj = Sentinel.Spawn(ProjectileClass, Sentinel,, RealStartProj + (BarrelDir * ProjSpawnOffset), rotator(Aim));
		if(Proj != None)
		{
		   Proj.InstigatorController = Sentinel.InstigatorController;
	    }
    }

    return Proj;
}

defaultproperties
{
     FireRate=0.900000
     FireSound=Sound'TFMedia.PepperPot.PepperPotFire'
     ProjectileClass=Class'taskforces.SentinelRocket'
     ProjSpawnOffset=32.000000
     WeaponAttachmentClass=Class'taskforces.SRLAttachment'
     WeaponOffset=(X=340.000000,Y=110.000000)
     Loudness=0.700000
     MaxAmmo=1
     AmmoAmount=1
     bNoAnim=True
     AmmoCost=1
     UpgradeName="Rocket Launcher"
     Description="A derivative of Evil Corp's popular 'PepperPot' portable rocket launcher, this weapon attachment fires a cluster of small, fast rockets.||There is limited space inside a Sentinel to store rockets, but your subscription to the ADS-1 support service means that replacement rockets will be translocated in from the nearest Evil Corp. warehouse as needed, freeing you from the logistics of resupplying Sentinels in the field."
     ActivateSound=Sound'WeaponSounds.RocketLauncher.SwitchToRocketLauncher'
}
